package com.qf.service.impl;

import com.qf.service.intf.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qf.common.vo.R;
import com.qf.entity.User;
import com.qf.dao.UserDao;

/**
 * @description: cool新闻
 * @author: No1
 * @create: 2020-11-30 11:33:07
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public R save(User user){
        if(userDao.insert(user)>0){
            return R.ok();
        }else{
            return R.fail("新增失败");
        }
    }
    @Override
    public R delById(int id){
        if(userDao.deleteById(id)>0){
            return R.ok();
        }else{
            return R.fail("删除失败");
        }
    }
    @Override
    public R all(){
       return R.ok(userDao.all());
    }
}
